package com.hy.controller;

import com.hy.Result.ResponseResult;
import com.hy.service.AppDoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/Doctor")
public class AppDoctorController {
    @Autowired
    private AppDoctorService appDoctorService;
    @RequestMapping("/list")
    public ResponseResult list() {
        try {
            return appDoctorService.list();
        } catch (Exception e) {
           e.printStackTrace();
           return new ResponseResult(400, "查询失败");
        }
    }
    @RequestMapping("/getDoctorByid/{id}")
    public ResponseResult getDoctorByid(@PathVariable("id") Integer id) {
        try {
            return appDoctorService.getDoctorByid(id);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResponseResult(400, "查询失败");
        }
    }
    @RequestMapping("/getDoctorinfo/{id}")
    public ResponseResult getDoctorinfo(@PathVariable("id") Integer id) {
        System.err.println(id);
        try {
            return appDoctorService.getDoctorinfo(id);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResponseResult(400, "查询失败");
        }
    }
}
